package cn.hls.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import cn.hls.dao.CertSetDao;
import cn.hls.entity.CertSet;
import cn.hls.entity.vo.PageInfo;
import cn.hls.service.CertSetService;
/**
 *@fileName: CertSetDaoImpl
 *@package: cn.christ.dao.impl
 *@Description: 证书到期提醒数据操作接口实现类
 *@author: yinghui.zhang
 *@email: uuhui@163.com
 *@date: 2015-09-25
 */
@Service("certSetService")
public class CertSetServiceBean extends BaseServiceBean<CertSet> implements CertSetService {

	@Resource(name="certSetDao")
	private CertSetDao dao;
	@Override
	public boolean exists(CertSet entity)throws Exception{
		return dao.exists(entity);
	}

	@Override
	public PageInfo<CertSet> loadCertSetInfo(PageInfo<CertSet> page,
			CertSet entity) throws Exception {
		return dao.loadCertSetInfo(page, entity);
	}
 

	@Override
	public List<CertSet> loadCertSetInfo(CertSet entity) throws Exception {
		 return dao.loadCertSetInfo(entity);
	}
	
	@Override
	public boolean update(CertSet entity) throws Exception {
		CertSet tempEntity=dao.find(entity.getId());
		Date createTime=tempEntity.getCreateTime();
		Date updateTime=new Date();
		BeanUtils.copyProperties(entity, tempEntity);
		tempEntity.setCreateTime(createTime);
		tempEntity.setUpdateTime(updateTime);
		return super.update(tempEntity);
	}

	@Override
	public Map<String, CertSet> loadcertSetInfoToMap(CertSet entity)
			throws Exception {
		return dao.loadcertSetInfoToMap(entity);
	}
}
